package guyubao.com.utils;

import org.springframework.stereotype.Component;

import java.util.Arrays;

@Component
public class SendMailType {
    /*
    * login:登录
    * apply:申请
    * message:推送渠道
    * register:注册
    * resetPassword:修改密码
    * resetUserName:修改账户
    * resetEmail:修改邮箱
    * relieveJDAccount:解除京东账户
    * relieveAccount:解除账户
    * updateJDCertificate:更新京东凭证
    * updateJDAccountComment:更新京东备注
    * updateJDAccountAccount:更新京东账户
    * updateJDAccountNickname:更新京东昵称
    */
    private final static String[] type = {"register","resetPassword",
            "resetUserName","resetEmail","login","apply","message",
            "relieveJDAccount","relieveAccount","updateJDCertificate",
            "updateJDAccountComment","updateJDAccountAccount","updateJDAccountNickname"};

    public boolean isExistence(String str){
        long count = Arrays.stream(this.type).filter((String name) -> name.equals(str)).count();
        return count!=0?true:false;
    }
    public String parseEmailSubject(String title) {
        switch (title) {
            case "register":
                return "欢迎注册此网站";
            case "resetPassword":
                return "您正在重置密码";
            case "resetUserName":
                return "您正在重置用户名";
            case "resetEmail":
                return "您正在重置邮箱";
            case "login":
                return "您正在进行登录验证";
            case "apply":
                return "您正在申请新的账号";
            case "message":
                return "您正在修改通知渠道";
            case "relieveJDAccount":
                return "您正在解除账号";
            case "relieveAccount":
                return "您正在解除用户";
            case "updateJDCertificate":
                return "您正在更新京东凭证";
            case "updateJDAccountComment":
                return "您正在更新账号备注";
            case "updateJDAccountAccount":
                return "您正在更新京东账号";
            case "updateJDAccountNickname":
                return "您正在更新京东昵称";
            default:
                return "";
        }
    }
    
}
